Your question is related to understanding of OSI model. Proxies use
socks protocol, I assume you are talking about
http which is an Application Layer (L7) protocol in OSI model. When an application generates
http message, it's handed over to lower layer. In case of
https, message is encrypted by SSL/TLS which are L6 protocols. At L4 the message gets a TCP header and then at L3 it's converted to an IP packet. This packet goes through NAT and firewalls filtering at L3, and finally through RRM/PDCP/RLC (if using Mobile Data), MAC and kernel routing at L2. At L1 it's transmitted over Wi-Fi as
802.11 frames or CDMA/TDMA/FDMA signals over Mobile Data.
Hotspot on the other hand is mainly based on 2 userspace tools;
hostapd - which creates Wi-Fi Access Point at OSI L2 - and
dnsmasq (up to Android 9) - which works as DHCP/DNS server at OSI L7. If the connected host is using phone as DNS server (as configured by DHCP), phone receives DNS queries and recursively forward them as UDP/IP packets to upstream DNS server on internet (whatever
dnsmasq is configured to use). Rest of the traffic coming from hotspot network is NATed and routed at L3/L2.
So you see none of the (IP packets) traffic coming from connected hosts goes through
http stack on Android phone, hence not being forwarded to proxy server. It's the responsibility of applications like Web Browsers to make
http(s) connections to proxy server, not directly to remote host like web server. It's not possible to create a hotspot which can be configured to use
http proxy at OSI L7. Proxy settings (host/port) we set for Wi-Fi or APN or globally are just forwarded to applications, each application has to create proxied connection on its own, or just ignore the proxy information. You need to provide these proxy details to apps on every host connected over hotspot. See question linked below for more details.
However it's possible to forcefully redirect the whole traffic towards a proxy server by using Linux/Android kernel's NAT/REDIRECT/TPROXY (at L3) and routing table (at L2). That's how proxifiers work, but there are limitations. Email clients use IMAP/POP3/SMTP (L6/7) protocols which won't work with
http GET method, instead require
http CONNECT proxies. Latter can only forward TCP traffic, for UDP at least SOCKS5 proxy is needed which operates at L5. DNS and mostly games and voice calling apps generate UDP traffic, so they won't work with
http proxies at all.
ping utility - for instance - uses ICMP (at L3) which can't be encapsulated in TCP or UDP, so it won't work with SOCKS5 too.
So it's not possible in true sense to redirect all traffic towards a remote (proxy) server without using a L2/3 solution like VPN. For more details see How to set Wi-Fi HTTPS proxy, not HTTP, via adb shell?
Why such behavior if the hotspot is supposed to use the mobile network and the proxy is set in APN for it?
Hotspot is supposed to use the mobile network, apps are supposed to use the proxy. The proxy you configured in APN isn't enforced system-wide.
I do not want to set proxy under advanced setting on other device WiFi option while choosing this hotspot.
Unfortunately this is the most straightforward way, other methods require either rooting and/or using third party apps (to create VPN). See above linked question on how to enforce proxy transparently.