I am trying to override /module-sales/view/frontend/templates/order/view.phtml by di.xml 

    <preference for="Magento\Sales\Block\Order\View" type="Myvendor\Mymodule\Block\Order\View"/>

The Block i added is

    namespace Myvendor\Mymodule\Block\Order;
    
    use Magento\Customer\Model\Context;
    
    
    class View extends \Magento\Sales\Block\Order\View
    {
        /**
         * Core registry
         *
         * @var \Magento\Framework\Registry
         */
        protected $_coreRegistry = null;
    
        /**
         * @var \Magento\Customer\Model\Session
         */
        protected $_customerSession;
    
        /**
         * @var \Magento\Payment\Helper\Data
         */
        protected $_paymentHelper;
    
        /**
         * @param \Magento\Framework\View\Element\Template\Context $context
         * @param \Magento\Framework\Registry $registry
         * @param \Magento\Framework\App\Http\Context $httpContext
         * @param \Magento\Payment\Helper\Data $paymentHelper
         * @param array $data
         */
    
        public function __construct(
            \Magento\Framework\View\Element\Template\Context $context,
            \Magento\Framework\Registry $registry,
            \Magento\Framework\App\Http\Context $httpContext,
            \Magento\Payment\Helper\Data $paymentHelper,
    	\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
            array $data = []
        ) {
            $this->_paymentHelper = $paymentHelper;
            $this->_coreRegistry = $registry;
            $this->httpContext = $httpContext;
          	$this->scopeConfig = $scopeConfig;
    	parent::__construct($context,$registry,$httpContext, $paymentHelper, $data);
            $this->_isScopePrivate = true;
        }
    
    
    
    
    	public function getTemplate() 
    	{
         		$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
         		$customOrderViewConfig = $this->scopeConfig->getValue('customorderview/enabled/fieldid', $storeScope);
        		if ($customOrderViewConfig) {
            		return 'corder/view.phtml';
        		}
        		return parent::getTemplate();
    	}
    
    	public function setTemplate($template)
    	{
         		$storeScope = \Magento\Store\Model\ScopeInterface::SCOPE_STORE;
         		$customOrderViewConfig = $this->scopeConfig->getValue('customorderview/enabled/fieldid', $storeScope);
        		if ($customOrderViewConfig == 1) {
    			$_template = 'corder/view.phtml';
        		}
    		else
    		{
            		$template = 'Magento_Sales::order/view.phtml';
    		}
        	return parent::setTemplate($_template);
    	}
    }

This is working fine , but i want to load my Phtml file when my module is enabled.

I tried 

 - If condition in phtml file looks bad. 
 - No way to add ifConfig in layout ( There is no layout in my module ).
 - beforeToHtml function in block ( Not working ).
 - setTemplate function in block ( Not working ).

Any Help would be appreciated.